<?php
namespace app\app\controller\v1;
use app\app\Appbase;

//
//意见反馈
//
class Feedback extends Appbase 
{

	/**
	* 意见反馈新增
	* /app/v1/feedback/insert
	* 是否需要登录 
	* @is_need_login true
	*@method post
	*/
	public function insert(){
		$data =  request()->post();
		$uid = $data['uid']  = request() ->userId;
		try {
			$feedback = model('UserFeedback');
			if ( !$feedback->add($uid,$data) ) {
	           return $this->ReError( $feedback ->errorInfo );
	        }
			return $this->ReSucess();	
		} catch (\Exception $e) {
			return $this->ReError($e->getMessage());	
		}
	}
	
	/**
	* 意见反馈获取
	* /app/v1/feedback/getMyData
	* 是否需要登录 
	* @is_need_login true
	*/
	public function getMyData(){
		$uid = $data['uid']  = request() ->userId;
		try {
			
			$result = model("UserFeedback")
				->where('id',$uid)
				->field("create_user",true)
				->order("create_time desc")
				->select();
				
			if( empty($result)  ) return $this->ReError("请求错误");	
			
			return $this->ReSucess($result);	
			
		} catch (\Exception $e) {
			return $this->ReError($e->getMessage());	
		}
	}
	
	
}



